/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ifpb.pp.pl.conversor;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

/**
 *
 * @author Gabriella
 */
public class ConversorCep implements Converter{

    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        String cepForamatado = null;
        String valor = value.trim();
        if(value == null)
            return null;
        cepForamatado = valor.substring(0,5)+"-"+valor.substring(5,8);
        return cepForamatado;
    }

    public String getAsString(FacesContext context, UIComponent component, Object value) {
        String valor = value.toString();
        return valor;
    }


}
